import threading
import socket

class Listener(threading.Thread):
	# constructor
	def __init__(self, handler, logger, sock):
		threading.Thread.__init__(self)
		self.sock = sock
		self.mHandler = handler
		self.logger = logger
    
	# loop die luistert
	def run(self):
		while True:
			data = self.sock.recvfrom(200)
			self.logger.addqueue("received %s, from %s:%s" % data, "Listener")
			self.mHandler.add_queue(data)
